Skip to content

Conversation

@Srinu346
Copy link
Contributor

Summary

Adds Dockerfile and docker-compose support to the fasthttp-postgres quickstart for easier setup.

Changes

  • Added Dockerfile to build and run the FastHTTP Go application.
  • Updated docker-compose to start the app with PostgreSQL.
  • Updated the README to reflect the Docker-based setup and Keploy usage.

Fixes

url

Screenshots

image

Signed-off-by: Akella Srinivas <alsrinivas.346@gmail.com>
@Srinu346 Srinu346 force-pushed the fix/fasthttp-postgress-docker-setup branch from 7ba293b to f6ab8f5 Compare December 22, 2025 15:07
Copy link
Member

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346 , the changes look good overall 👍

A couple of suggestions:

  • Please avoid using the latest Alpine image in the Dockerfile and switch to a specific version instead.

  • The README should cover two ways to run the app:

    1. Using Docker Compose
    2. Running the app without Docker
      Currently, it only documents the Docker Compose method.
  • Please remove the gocoverage command from the Keploy test command. We don’t have a gocoverage flag when running Keploy via the Docker Compose method.

@Srinu346 Srinu346 force-pushed the fix/fasthttp-postgress-docker-setup branch from 9e3cfee to f6ab8f5 Compare December 24, 2025 10:45
Signed-off-by: Akella Srinivas <alsrinivas.346@gmail.com>
@Srinu346
Copy link
Contributor Author

@Achanandhi-M sir made the described changes, please take a look.

Signed-off-by: Akella Srinivas <alsrinivas.346@gmail.com>
Signed-off-by: Akella Srinivas <alsrinivas.346@gmail.com>
Copy link
Member

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346,

Could you please update the README when you get a chance? It would be great if it could include both the record and replay commands, along with the appropriate curl commands for testing.

@Srinu346
Copy link
Contributor Author

@Achanandhi-M sir
I think I’ve already updated the README to include both Keploy record and replay (keploy test) commands, along with curl examples for generating test cases (POST and GET requests).
fasthttp-postgres-combined-regenerated


Capture testcases:
```shell
keploy record -c "docker-compose up" --container-name=fasthttp_app
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346 I noticed that there’s no keploy test command mentioned in option 1, and there are also no curl commands provided. Could you please clarify how users are expected to test this without the curl commands?


Run With Docker:
```shell
keploy test -c "docker-compose up" --container-name=fasthttp_app --delay 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the keploy test Docker Compose up command has been added in option 2, but the Docker setup isn’t mentioned. Could you please clarify how this is expected to work?

Copy link
Member

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346,

Users should be able to navigate clearly in both the Docker and non-Docker setups. Could you please add the curl commands for both setups and clearly mention the steps? Also, please go through the comments carefully. Also please sign the DCO

Signed-off-by: Akella Srinivas <alsrinivas.346@gmail.com>
@Srinu346 Srinu346 force-pushed the fix/fasthttp-postgress-docker-setup branch from 1f31070 to 5d01bd0 Compare December 30, 2025 09:23
@Srinu346
Copy link
Contributor Author

Hello @Achanandhi-M sir,

My initial assumption was to keep the steps till keploy record and the curl commands common for both Docker and non-Docker setups, and then split only at the testing stage. I see now that this makes the flow unclear.

image

Now I’ve updated the flow and clearly split the Docker and non-Docker paths separately now. Each Path independently includes:
Run server → Record → curl commands -> Replay(Test)

image

Thanks for the review.

Copy link
Member

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Srinu346, could you please fix the issues I mentioned and refer to the Keploy docs while doing so? It would be great if you could test everything from your side before raising the PR, as it helps save reviewers’ time. Thank you for understanding. also please fix the linter issue


```shell
keploy test -c "./app" --goCoverage --delay 10
keploy test -c "go run main.go" --goCoverage --delay 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346, could you please update the test command and remove --goCoverage? We’ve removed it recently.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed it now sir.

#### Start the Postgres container:
```bash
go build -cover
docker-compose up -d postgres
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docker-compose command is deprecated. Please use the docker compose command instead. Kindly try it from your side, and if it works, proceed with the changes.

Copy link
Contributor Author

@Srinu346 Srinu346 Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed all the docker-compose to docker compose . I have also checked them by running on my machine.


### Option 2: Run Without Docker

> Note: When running the app locally, ensure `DB_HOST=localhost` is set in the environment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement isn’t very clear about where the environment variables should be added. The environment variables should be added inside the Postgres service.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I have removed that line completely, sir.
When the application is run fully using Docker, these values are injected automatically via Docker Compose (as shown below).

image

Otherwise, the application falls back to the default values, so there is no need for users to manually set the environment variables.
image

Please let me know if this approach looks fine or if you’d prefer the environment variables to be explicitly documented instead.


#### Run the application:
```bash
go run main.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t need a separate command to run the application. Keploy starts the app automatically when it runs, so please remove this line. For more context, kindly refer to the Quickstart documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK sir i have removed them.

#### Start the server:
```bash
sudo docker-compose up -d postgres
docker-compose up --build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t need a separate command to run the application. Keploy starts the app automatically when it runs, so please remove this line. For more context, kindly refer to the Quickstart documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK sir i have removed them.

@Srinu346 Srinu346 force-pushed the fix/fasthttp-postgress-docker-setup branch from 515dde3 to 5d01bd0 Compare January 6, 2026 06:39
Signed-off-by: Akella Srinivas <alsrinivas.346@gmail.com>
@Srinu346
Copy link
Contributor Author

Srinu346 commented Jan 6, 2026

@Achanandhi-M sir, I’ve gone through the Keploy quickstart guide and updated the commands accordingly. I’ve also fixed the lint issues and addressed the above review comments.

Please let me know if any further changes are needed.

Copy link
Member

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Srinu346, the changes look really great—nice work! I just have one piece of feedback.

In the Option 2 setup, the user needs to create a .env file to pass the environment variables, but this isn’t mentioned clearly in the README. As a first-time user following the guide, I wasn’t able to run it successfully.

Have you tried this from your side? Is it working fine for you?

@Srinu346
Copy link
Contributor Author

Srinu346 commented Jan 6, 2026

Thanks for the feedback, sir.

In Option 2, when PostgreSQL is started via Docker using the provided docker-compose setup, there is actually no strict requirement to create a .env file. The application already has sensible defaults for all database-related environment variables:

DB_HOST defaults to localhost

DB_PORT defaults to 5432

DB_USER defaults to postgres

DB_PASSWORD defaults to password

DB_NAME defaults to db

image

These defaults match the credentials with which the PostgreSQL service is started in Docker, so the application works even if no .env file or environment variables are provided.

A .env file or explicit environment variables are only required if the user wants to connect to a PostgreSQL instance that differs from the Docker-provided setup (for example, an external or custom database).

I’ve tested this flow from my side and it works as expected.

Screen.Recording.2026-01-06.142355.mp4

@Achanandhi-M
Copy link
Member

Hey @Srinu346, could you please confirm by running it with Keploy? Also, please try running the first method followed by the second method. I just want to confirm everything is working properly before merging the PR.

Signed-off-by: Akella Srinivas <alsrinivas.346@gmail.com>
@Srinu346
Copy link
Contributor Author

Srinu346 commented Jan 6, 2026

After your review sir, I revisited the setup and realized that Keploy does not automatically pick up environment variables from docker-compose.yml, which is why the .env file was added and the README updated accordingly.

First method

Screen.Recording.2026-01-06.144900.mp4

Second method

Screen.Recording.2026-01-06.154836.mp4

@Achanandhi-M
Copy link
Member

Hey @Srinu346, could you please address the comment I mentioned? Once that’s fixed, it’ll be ready to merge. Thanks!

@Srinu346
Copy link
Contributor Author

Srinu346 commented Jan 9, 2026

Hey @Srinu346, the changes look really great—nice work! I just have one piece of feedback.

In the Option 2 setup, the user needs to create a .env file to pass the environment variables, but this isn’t mentioned clearly in the README. As a first-time user following the guide, I wasn’t able to run it successfully.

Have you tried this from your side? Is it working fine for you?

Yes, sir. Initially when I tried running Option 2 on my side without creating a .env file, I faced the following error:

🐰 Keploy: ERROR failed setting up the environment {"error": "keploy-agent did not become ready in time"}

After that, based on your suggestion, I added the required .env file with the environment variables, and it started working.

The demo run for the second method that I shared earlier was recorded after adding the .env file. Based on this realization, I have now updated the README to clearly mention the need for creating a .env file for Option 2.

@Srinu346
Copy link
Contributor Author

Srinu346 commented Jan 9, 2026

But even after adding the .env file, when I run
keploy record -c "go run main.go", the application does start and run correctly (as shown in the video), but sometimes Keploy still fails with the same error.
🐰 Keploy: ERROR failed setting up the environment {"error": "keploy-agent did not become ready in time"}

I’ve shared the complete logs here for better context:
https://logpasta.com/paste/452717ac-4856-4f38-8e0b-e60b91a8c7f5

From my side, I don’t feel this is an issue with the application code, since it runs successfully at times without any changes. Because the behavior is inconsistent, I believe the issue is more likely related to my local machine setup or something else, rather than the code.

Could you please help me understand or give any suggestion regarding what might be causing this intermittent failure and how I can debug or stabilize the Keploy agent in this setup?

@Achanandhi-M
Copy link
Member

But even after adding the .env file, when I run keploy record -c "go run main.go", the application does start and run correctly (as shown in the video), but sometimes Keploy still fails with the same error. 🐰 Keploy: ERROR failed setting up the environment {"error": "keploy-agent did not become ready in time"}

I’ve shared the complete logs here for better context: https://logpasta.com/paste/452717ac-4856-4f38-8e0b-e60b91a8c7f5

From my side, I don’t feel this is an issue with the application code, since it runs successfully at times without any changes. Because the behavior is inconsistent, I believe the issue is more likely related to my local machine setup or something else, rather than the code.

Could you please help me understand or give any suggestion regarding what might be causing this intermittent failure and how I can debug or stabilize the Keploy agent in this setup?

But even after adding the .env file, when I run keploy record -c "go run main.go", the application does start and run correctly (as shown in the video), but sometimes Keploy still fails with the same error. 🐰 Keploy: ERROR failed setting up the environment {"error": "keploy-agent did not become ready in time"}

I’ve shared the complete logs here for better context: https://logpasta.com/paste/452717ac-4856-4f38-8e0b-e60b91a8c7f5

From my side, I don’t feel this is an issue with the application code, since it runs successfully at times without any changes. Because the behavior is inconsistent, I believe the issue is more likely related to my local machine setup or something else, rather than the code.

Could you please help me understand or give any suggestion regarding what might be causing this intermittent failure and how I can debug or stabilize the Keploy agent in this setup?

Hey @Srinu346, the issue doesn’t appear to be related to the Keploy agent. Keploy runs alongside your application as a proxy, so if the application itself fails, Keploy will also fail. This means it’s not a Keploy-specific problem.

Please review my earlier comments. If you’re facing issues, first try running the application without Keploy to confirm whether it works correctly. If it does, then run it with Keploy. In this case, please try option 2 without providing the .env file and check whether it fails—this should help identify the actual problem.

Based on this, I’m confident the issue is not coming from Keploy.

@Srinu346
Copy link
Contributor Author

Srinu346 commented Jan 9, 2026

I have tried the steps suggested by you sir,

  • The application was working properly when ran without keploy [ran both get and post requests and they were working as expected]

Sir this is without .env setup

When i ran it with keploy record -c "go run main.go" i am again hitting the same error.

`akella_srinivas@LAPTOP-CJ9E377H:/mnt/c/Users/Akella Srinivas/DingDing/samples-go/fasthttp-postgres$ keploy record -c "go run main.go"
version: 3.0.3

🐰 Keploy: 2026-01-09T16:37:39.250210652Z INFO 🔴 Starting Keploy recording... Please wait.
🐰 Keploy: 2026-01-09T16:37:39.27522606Z INFO Using available ports {"agent-port": 33767, "proxy-port": 16789, "dns-port": 26789}
🐰 Keploy: 2026-01-09T16:37:39.290010954Z INFO Starting native agent with args {"args": ["agent", "--port", "33767", "--proxy-port", "16789", "--dns-port", "26789", "--client-pid", "39776", "--mode", "record", "--build-delay", "30"]}
🐰 Keploy: 2026-01-09T16:37:39.293028491Z INFO keploy agent started {"pid": 39813}
🐰 Keploy: 2026-01-09T16:37:39.295780128Z INFO Agent is now running, proceeding with setup
🐰 Keploy: 2026-01-09T16:38:09.754494493Z ERROR failed setting up the environment {"error": "keploy-agent did not become ready in time"}
🐰 Keploy: 2026-01-09T16:38:09.755451679Z INFO stopping Keploy {"reason": "failed setting up the environment"}
🐰 Keploy: 2026-01-09T16:38:09.756470691Z INFO 🔴 Stopping Keploy recording... in the defer
🐰 Keploy: 2026-01-09T16:38:09.757311886Z INFO Client context cancelled, stopping agent
🐰 Keploy: 2026-01-09T16:38:09.758702459Z INFO Stopping keploy agent {"pid": 39813}
🐰 Keploy: 2026-01-09T16:38:09.761211231Z INFO Keploy agent process killed successfully
🐰 Keploy: 2026-01-09T16:38:09.782190471Z INFO agent process stopped
🐰 Keploy: 2026-01-09T16:38:09.785566978Z ERROR failed to record {"error": "failed setting up the environment"}

But it is working properly with keploy record -c "sleep 10 && go run main.go"

akella_srinivas@LAPTOP-CJ9E377H:/mnt/c/Users/Akella Srinivas/DingDing/samples-go/fasthttp-postgres$ keploy record -c "sleep 10 && go run main.go"

version: 3.0.3

🐰 Keploy: 2026-01-09T16:38:44.621751114Z INFO 🔴 Starting Keploy recording... Please wait.
🐰 Keploy: 2026-01-09T16:38:44.635594294Z INFO Using available ports {"agent-port": 44055, "proxy-port": 16789, "dns-port": 26789}
🐰 Keploy: 2026-01-09T16:38:44.64647172Z INFO Starting native agent with args {"args": ["agent", "--port", "44055", "--proxy-port", "16789", "--dns-port", "26789", "--client-pid", "39852", "--mode", "record", "--build-delay", "30"]}
🐰 Keploy: 2026-01-09T16:38:44.648630391Z INFO keploy agent started {"pid": 39878}
🐰 Keploy: 2026-01-09T16:38:44.663845166Z INFO Agent is now running, proceeding with setup
🐰 Keploy: 2026-01-09T16:39:13.017875551Z INFO Client setup completed successfully
🐰 Keploy: 2026-01-09T16:39:13.018781717Z INFO Command type: {"commandType": "native"}
🐰 Keploy: 2026-01-09T16:39:13.020822286Z INFO 🟢 Keploy agent is ready to record test cases and mocks.
🐰 Keploy: 2026-01-09T16:39:13.022200036Z INFO 🟢 Keploy is now recording test cases and mocks for you application...
🐰 Keploy: 2026-01-09T16:39:13.022419584Z INFO 🔵 Connecting to incoming test cases stream...
🐰 Keploy: 2026-01-09T16:39:13.022431167Z INFO 🔵 Connecting to outgoing mocks stream...
🐰 Keploy: 2026-01-09T16:39:13.024353571Z INFO 🔴 Stopping Keploy recording... Please wait.
🐰 Keploy: 2026-01-09T16:39:13.024652835Z INFO Starting Application : {"executing_cli": "/usr/bin/sh -c sleep 10 && go run main.go"}
2026/01/09 16:39:26 Starting server: http://localhost:8080
`

** Sir these both were run in the same configuration. No changes were made among them. **

@Srinu346
Copy link
Contributor Author

Srinu346 commented Jan 9, 2026

Hey @Srinu346, the changes look really great—nice work! I just have one piece of feedback.

In the Option 2 setup, the user needs to create a .env file to pass the environment variables, but this isn’t mentioned clearly in the README. As a first-time user following the guide, I wasn’t able to run it successfully.

Have you tried this from your side? Is it working fine for you?

Sorry to ask this directly, sir just wanted to confirm if this is the comment you were referring to?

@Achanandhi-M
Copy link
Member

Achanandhi-M commented Jan 12, 2026

Hey @Srinu346, I tried running the application without Keploy and I’m still facing the same issue. As mentioned earlier, this confirms that the problem is with the application itself and not with Keploy—you can also see this in my screenshot. You can see in my screenshot if i don't provide .env, application will thrown an error. There is no .env file in my code

Screenshot 2026-01-12 at 10 55 55 AM Screenshot 2026-01-12 at 10 55 55 AM

The only solution here is to remove the statement you added in the notes section. Please rephrase it to clearly mention that the .env file is required by the application itself, not because of Keploy. We’re adding it simply because the application needs it.

Signed-off-by: Akella Srinivas <alsrinivas.346@gmail.com>
@Srinu346
Copy link
Contributor Author

Ok sir, I have rephrased the read me and mentioned it clearly.

@Achanandhi-M
Copy link
Member

Hey @Srinu346, thanks for the changes. Just one final request—could you please remove the .env file and the app binary from the PR? We don’t want these to be included. Once that’s done, the PR will be ready to merge. Thanks!

@Srinu346
Copy link
Contributor Author

Sorry sir, i forgot to remove them, while pushing.

Signed-off-by: Akella Srinivas <alsrinivas.346@gmail.com>
@Srinu346
Copy link
Contributor Author

I have removed them sir.

Copy link
Member

@Achanandhi-M Achanandhi-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@khareyash05 khareyash05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Achanandhi-M Achanandhi-M merged commit e42880a into keploy:main Jan 12, 2026
19 checks passed
@Srinu346 Srinu346 deleted the fix/fasthttp-postgress-docker-setup branch January 12, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants